package com.kylin.payment.api.web.facade;

import com.kylin.payment.api.dto.req.PaymentReqDTO;
import com.kylin.payment.api.dto.req.RefundReqDTO;
import com.kylin.payment.api.dto.resp.PaymentRespDTO;
import com.kylin.payment.api.dto.resp.RefundRespDTO;
import com.kylin.shared.common.ResponseWrapper;
import org.springframework.http.MediaType;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

/**
 * 微信小程序支付接口
 * @author Damon S.
 * @version v1.0.1
 * @date 2019年10月30日 16:06
 */
@RequestMapping(value = "/api_v1/payment/wechat", produces = MediaType.APPLICATION_JSON_VALUE)
public interface PaymentPlatformFacade {

    /**
     * 小程序订单支付
     * @param req 支付请求参数
     * @return 返回支付结果
     */
    @PostMapping("/pay")
    ResponseWrapper<PaymentRespDTO> pay(
            @RequestBody @Validated PaymentReqDTO req
    );


    @GetMapping("/refund")
    ResponseWrapper<RefundRespDTO> refund(
            @RequestBody @Validated RefundReqDTO req
    );

    /**
     * 微信支付回调
     * @param notifyData 回调参数
     * @return 返回状态
     */
    @PostMapping("/notify")
    ModelAndView notify(
            @RequestBody String notifyData
    );
}
